package com.k7.mobile.platform.bo.impl;

import java.util.List;

import com.k7.mobile.platform.bo.IGramBO;
import com.k7.mobile.platform.dao.IGramDAO;
import com.k7.mobile.platform.dataobject.GramDO;
import com.k7.mobile.platform.dataobject.RankingDO;
import com.k7.mobile.platform.dataobject.RecommendxDO;
import com.k7.mobile.platform.exception.BOException;

public class GramBOImpl extends BaseBOImpl implements IGramBO{
	
	private IGramDAO gramDAO;

	public void setGramDAO(IGramDAO gramDAO) {
		this.gramDAO = gramDAO;
	}

	public Long add(GramDO gramDO) throws BOException {
		try{ 
			Long id=gramDAO.add(gramDO);
			return id;
		}catch(Exception ex){
			log.error("GramBOImpl:add,插入Gram失败", ex);
			throw new BOException("创建禁止Gram失败", ex);
		}
	}

	@Override
	public void delete(GramDO gramDO) throws BOException {
		try{
			gramDAO.delete(gramDO);
		}catch(Exception ex){
			log.error("GramBOImpl:delete,删除Gram失败", ex);
			throw new BOException("删除Gram失败", ex);
		}
		
	}
	@Override
	public void update(GramDO gramDO) throws BOException {
		try{
			gramDAO.update(gramDO);
		}catch(Exception ex){
			log.error("GramBOImpl:update,更新Gram失败", ex);
			throw new BOException("更新Gram失败", ex);
		}
		
	}

	@Override
	public List<GramDO> findList(GramDO gramDO) throws BOException {
		try{
			List<GramDO> list = gramDAO.findList(gramDO);
			return list;
		}catch(Exception ex){
			log.error("GramBOImpl:findList,批量获取Gram信息出错", ex);
			throw new BOException("批量获取Gram信息出错", ex);
		}
		
	}

	@Override
	public GramDO getGram(GramDO gramDO) throws BOException {
		try{

			GramDO returnDO = gramDAO.getGram(gramDO);

			return returnDO;
		}catch(Exception ex){
			log.error("GramBOImpl:getGram,获取Gram信息出错", ex);
			throw new BOException("获取Gram信息出错", ex);
		}
	}
	
	@Override
	public List<GramDO> findRankingGameList(RankingDO rankingDO) {
		try{
			List<GramDO> list = gramDAO.findRankingGameList(rankingDO);
			return list;
		}catch(Exception ex){
			log.error("RankingBOImpl:findRankingGameList,批量获取排行游戏信息出错", ex);
			throw new BOException(",批量获取排行游戏信息出错", ex);
		}
	}

	@Override
	public List<GramDO> findRecommendGameList(RecommendxDO recommendxDO) {
		try{
			List<GramDO> list = gramDAO.findRecommendGameList(recommendxDO);
			return list;
		}catch(Exception ex){
			log.error("RankingBOImpl:findRecommendGameList,批量获取推荐游戏信息出错", ex);
			throw new BOException(",批量获取推荐游戏信息出错", ex);
		}
	}	
	
}
